package com.wangmengtao.upms.controller;

import com.wangmengtao.upms.model.UpmsUserDetail;
import com.wangmengtao.upms.service.UpmsUserDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: UpmsUserDetailController
 * @Description: TODO
 * @Author: WangMengtao
 * @Data: 2019/6/5 17:15
 * @Version: 1.0.0
 */
@RestController
public class UpmsUserDetailController {
    @Autowired
    private UpmsUserDetailService upmsDetailService;

    @PostMapping(value = "/users/detail")
    public Object create(UpmsUserDetail upmsUserDetail) {
        return upmsDetailService.insert(upmsUserDetail);
    }

    @DeleteMapping(value = "/users/{id}/detail")
    public Object deleteById(@PathVariable("id") Long id) {
        return upmsDetailService.deleteById(id);
    }

    @PutMapping(value = "/users/detail")
    public Object update(UpmsUserDetail upmsUserDetail) {
        return upmsDetailService.update(upmsUserDetail);
    }

    @GetMapping(value = "users/{id}/detail")
    public Object getById(@PathVariable("id") Long id) {
        return upmsDetailService.getById(id);
    }

}
